package com.damie.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dadie.Dto.UserWasteOrderDto;
import com.dadie.Dto.WasteOrderDto;
import com.dadie.parame.WasteOrderParame;
import com.damie.common.commonutils.R;
import com.damie.facade.UserFacade;
import com.damie.service.WasteOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Alon
 * @since 2021-01-22
 */
@Api(value="站点controller",tags={"后台:订单查询"})
@RestController
@CrossOrigin("*")
@RequestMapping("/damie/waste-order")
public class WasteOrderController {

    @Resource
    private WasteOrderService service;

    @Resource
    private UserFacade userFacade;

    @ApiOperation("条件查询所有订单")
    @PostMapping("selectAllOrder")
    public R selectAllOrder(Integer index, Integer size, @RequestBody WasteOrderParame wasteOrderParame){
        Page<UserWasteOrderDto> wasteOrderDtos = service.selectAllOrder(index, size,wasteOrderParame);
        return R.ok().data("orderList",wasteOrderDtos);
    }
    @ApiOperation("某个订单的详细信息")
    @GetMapping("selectById")
    public R selectById(String id){
        WasteOrderDto wasteOrderDtos = service.selectById(id);
        return R.ok().data("order",wasteOrderDtos);
    }

}

